<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Performance Tests</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Safe Numerics">
<link rel="up" href="index.html" title="Safe Numerics">
<link rel="prev" href="checked_integer_arithmetic.html" title="safe_compare&lt;T, U&gt;">
<link rel="next" href="rationale.html" title="Rationale and FAQ">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img href="index.html" height="164px" src="pre-boost.jpg" alt="Library Documentation Index"></td>
<td><h2>Safe Numerics</h2></td>
</tr></table>
<div class="spirit-nav">
<a accesskey="p" href="checked_integer_arithmetic.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="safe_numerics.performance_tests"></a>Performance Tests</h2></div></div></div>
<p>Our goal is to create facilities which make it possible to write
    programs known to be correct. But we also want programmers to actually use
    the facilities we provide here. This won't happen if using these
    facilities impacts performance to a significant degree. Although we've
    taken precautions to avoid doing this, the only real way to know is to
    create and run some tests.</p>
<p>So far we've only run one explicit performance test -
    <code class="filename"><a href="../../test/test_performance.cpp" target="_top">test_performance.cpp</a></code>.
    This runs a test from the Boost Multiprecision library to count prime
    numbers and makes extensive usage of integer arithmetic. We've run the
    tests with <code class="computeroutput">unsigned</code> integers and with
    <code class="computeroutput">safe&lt;unsigned&gt;</code> on two different compilers.. No other
    change was made to the program. We list the results without further
    comment.</p>
<pre class="screen">g++ (GCC) 6.2.0
Testing type unsigned:
time = 17.6215
count = 1857858
Testing type safe&lt;unsigned&gt;:
time = 22.4226
count = 1857858

clang-802.0.41
Testing type unsigned:
time = 16.9174
count = 1857858
Testing type safe&lt;unsigned&gt;:
time = 36.5166
count = 1857858
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2012-2018 Robert Ramey<p><a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost
      Software License</a></p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="checked_integer_arithmetic.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>
